<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/jquery-3.4.1.js"></script>
    <style type="text/css">
        .box {

        }

        .box > .menu {
            width: 200px;
        }

        .box > .menu > .level1 {
            list-style: none;
            margin: 2px auto;
            text-align: center;
            height: 21px;
            overflow: hidden;
            border: #bf3d3d 1px solid;
            border-radius: 3px;

            /* height属性过渡动画 */
            transition: height 1s;
        }

        .box > .menu > .level1 > .menu > .level2 {
            list-style: none;
            margin: 0 auto;
            border-top: #000000 2px solid;
            border-left: none;
            border-right: none;
        }

        .current {
            height: 115px !important;
        }
    </style>
</head>
<body>
<div class="box">
    <ul class="menu">
        <li class="level1 current">
            <a href="#none">裤子</a>
            <ul class="menu">
                <li class="level2"><a href="#none">裤子1</a></li>
                <li class="level2"><a href="#none">裤子2</a></li>
                <li class="level2"><a href="#none">裤子3</a></li>
                <li class="level2"><a href="#none">裤子4</a></li>
            </ul>
        </li>
        <li class="level1">
            <a href="#none">短袖</a>
            <ul class="menu">
                <li class="level2"><a href="#none">短袖1</a></li>
                <li class="level2"><a href="#none">短袖2</a></li>
                <li class="level2"><a href="#none">短袖3</a></li>
                <li class="level2"><a href="#none">短袖4</a></li>
            </ul>
        </li>
        <li class="level1">
            <a href="#none">毛衣</a>
            <ul class="menu">
                <li class="level2"><a href="#none">毛衣1</a></li>
                <li class="level2"><a href="#none">毛衣2</a></li>
                <li class="level2"><a href="#none">毛衣3</a></li>
                <li class="level2"><a href="#none">毛衣4</a></li>
            </ul>
        </li>
    </ul>
</div>
<script type="text/javascript">

    $(function () {
        $(".level1 > a").click(function () {
            // 给当前元素的父元素添加current, 并给当前元素的父元素的兄弟元素删除current类属性， 因为current属性控制着是否显示。
            $(this).parent().addClass("current").siblings().removeClass("current");
        });
    })

</script>
</body>
</html>